package main

func isIsomorphic(s string, t string) bool {
	m := map[byte]byte{}
	mapped := map[byte]struct{}{}
	for i, s_ := range s {
		sc := byte(s_)
		tc := byte(t[i])
		s2, ok := m[sc]
		if ok {
			if s2 == tc {
				continue
			} else {
				return false
			}
		} else {
			if _, ok := mapped[tc]; ok {
				return false
			}
			m[sc] = tc
			mapped[tc] = struct{}{}
		}
	}
	return true
}

func main() {
	println(isIsomorphic("badc", "baba"))
}
